<?php
namespace Swoole;
$http = new Http\Server('0.0.0.0', 8001);
$http->on('request', function(Http\Request $request, Http\Response $response){
    //$value = time();
    $redis = new Coroutine\Redis();
    $redis->connect('127.0.0.1',6379);
    $redis->set('name',$request->get['name']);
    var_dump($request->get['name']);
    /*
    $mysql = new Coroutine\MySQL();
    $mysqlConfig = array(
        'host' => '127.0.0.1',
        'user' => 'root',
        'password' => 'root',
        'database' => 'test',
    );
    $mysql->connect($mysqlConfig);
    $res = $mysql->query("insert into test1 values($value)");
     * 
     */
    $response->header("Content-Type","text/plain");
    $response->end($request->get['name']);
    /*
    echo PHP_EOL;
    echo PHP_EOL;
    echo PHP_EOL;
    echo PHP_EOL;
    echo PHP_EOL;
    echo PHP_EOL;
     * 
     */
});
$http->start();

